#pragma once

#include "sysconfig.h"

class Logger
{
    private:

        static int realconsole;
        static HANDLE stdinput;
        static HANDLE stdoutput;
        static int bootlogmode;
        static CRITICAL_SECTION cs;
        static bool cs_init;
        static FILE* debugfile;
        static int debugger_type;
        // static int lfdetected;
        static TCHAR* console_buffer;
        static int console_buffer_size;

        static void getconsole();
        static void open_console_window();
        static void openconsole();
        static void writeconsole(const TCHAR* buffer);
        static void writeconsole_2(const TCHAR* buffer);
        static void console_put(const TCHAR* buffer);
        static TCHAR* writets();

    public:

        static int ConsoleOpen;

        static void Write(const TCHAR* format, ...);
        static void WriteLine(const TCHAR* format, ...);
        static void Flush();
        static void Open(const TCHAR* name, int append, int bootlog);
        static void Close();

        static void ConsoleClose();
        static void ConsoleReopen();
        static void ConsoleOut(const TCHAR* format, ...);
        static void ConsoleFlush();
        static int ConsoleGet(TCHAR* format, int maxlen);
        static TCHAR ConsoleGetChar();

        static void FileOut(void* file, const TCHAR* format, ...);
        static TCHAR* BufferOut(TCHAR* buffer, int* bufsize, const TCHAR* format, ...);
        static void JitAbort(const TCHAR* format, ...);
        static void DebuggerChange(int mode);

        static TCHAR* setconsolemode(TCHAR* buffer, int maxlen);
};